mudbox::Attribute Struct Reference

#include <node.h>

Inheritance diagram for mudbox::Attribute:

Inheritance graph
[legend]
List of all members.

Detailed Description

This is an abstract base structure for all attributes. Do not use it directly, use AttributeInstance instead.

Each node has a list of attributes with different types. The attributes are used like plain data members of the node class, but in case of attributes, mudbox will be able to get a list of all the attributes in a node, and for example it will be possible so simply display a dialog to the used where it is possible to check and alter the value of the variables.


Public Types

enum   AttributeType {
  typeUnknown, typeInt, typeFloat, typeBool,
  typeString, typePointer, typeColor, typeVector,
  typeEnum, typeWatch
}
  Type of the attribute. More...

Public Member Functions

unsigned int  TargetCount (void) const
  Returns the number of attributes currently linked to this attribute as target.
Attribute Target (unsigned int iIndex) const
  Returns the target with the given index. If iIndex is greater than the number of targets, returns 0;.
Attribute Source (void)
  Returns the source attribute, or 0 if there is no source.
bool  operator== (const Attribute &cAttribute) const
  This is a special operator, it does NOT compare the value of the attribute. See Node::OnNodeEvent for details.
bool  operator!= (const Attribute &cAttribute) const
  This is a special operator, it does NOT compare the value of the attribute. See Node::OnNodeEvent for details.
virtual AttributeType  Type (void) const
  Returns the type of the attribute.
QString  ID (void) const
  Returns the unique ID (within this node) of the attribute.
QString  Name (void) const
  Returns the name of the attribute.
void  SetName (const QString &sName)
  Sets the name of the attribute.
QString  Category (void) const
  Returns the category of the attribute.
void  SetCategory (const QString &sCategory, bool bSeparator=false)
  Sets the category of the attribute. This value will be used in the user interface to determine which attribute group to be used.
bool  Separator (void) const
  Returns the separator state of the widget.
void  SetSeparator (bool bSeparator)
  Call this with true to display a separator line below this widget.
bool  Const (void) const
  Gets the constant status of the attribute. Default value is false. If this is set to true the attribute will not be editable by the user on the interface.
void  SetConst (bool bConst)
  Sets the constant status of the attribute. Default value is false. If this is set to true the attribute will not be editable by the user on the interface.
bool  Visible (void) const
  Returns true if the property is visible.
void  SetVisible (bool bVisible)
  Sets the visible status of the property.
QString  ToolTip (void) const
  Gets the tooltip text to be used on the user interface, this is optional.
void  SetToolTip (const QString &sToolTip)
  Sets the tooltip text to be used on the user interface, this is optional.
unsigned int  Size (void) const
  Returns the size of the attribute value in bytes.
float  LabelWidth (void) const
  Returns the width of label relative to the full width of the line.
void  SetLabelWidth (float fLabelWidth)
  Set the width of label.
int  Index (void) const
  Returns the attribute index;.
void  SetIndex (int iIndex)
  Sets the attribute index;.
Node Owner (void) const
  Gets the address of the Node which contains this attribute.
virtual void  Serialize (Stream &s)
  Serialize the value of the attribute into a stream.
virtual QString  AsString (void) const
  Returns the value of the attribute as a string. See also SetFromString.
virtual void  SetFromString (const QString &sValue)
  Sets the value of the attribute as a string. See also AsString.
virtual  ~Attribute (void)
virtual void  StartEvent (NodeEventType cType) const
void  SetOwner (Node *pOwner)
  This function sets the owner of the attribute. The owner receives all events for this attribute.
virtual AttributeWidget CreateEditorWidget (QWidget *pParent, int iWidth)
  This function creates and returns the address of a QWidget object.
void  LogTargets (void)
  Log all targets (for debug purposes).
Attribute connecting functions
These functions are related to creating dependent connections between attributes.

When a source attribute value changes, the target attribute value will change also.

void  ClearTargets (void)
  Removes all outgoing connections from the attribute.
void  ClearSource (void)
  Removes the incoming connection for this attribute.
virtual void  AddTarget (Attribute &cTarget)
  Adds a new outgoing connection for this node to pTarget.
void  Connect (Attribute &cSource)
  Connect this attribute to another one.
virtual void  UpdateTargets (void)
  Update the values of all the connected target attributes with the current value. Used internally only, do not call this directly.
Pointer attribute functions
These functions are intended for use only with AttributePointer.

virtual const ClassDesc TargetType (void) const
  This is valid only for pointer attributes (See AttributePointer). Returns the type of the pointer.
virtual void  SetPointerValue (Node *pValue, bool bLink=true)
  This is valid only for pointer attributes (See AttributePointer). Sets the value of the pointer. This function is used only if you dont know exactly the type of the attribute. Use AttributePointer::SetValue otherwise.
virtual Node PointerValue (void) const
  This is valid only for pointer attributes (See AttributePointer). Gets the value of the pointer. This function is used only if you dont know exactly the type of the attribute. Use AttributePointer::Value otherwise.
virtual bool  ValidatePointerValue (const Node *pValue)
  Validate a possible value for the pointer, returns true if the value is acceptable.
Parameter functions
These functions allow you to query or modify the parameters associated with an attribute.

Returns the number of parameters assigned to this attribute.

virtual unsigned int  ParameterCount (void) const
virtual QString  ParameterName (unsigned int iIndex) const
  Returns the name of a parameter with a given index.
virtual QString  ParameterValue (unsigned int iIndex) const
  Returns the value of parameter with a given index.
virtual void  SetParameterValue (const QString &sName, const QString &sValue)
  Set the value of a parameter.

Protected Member Functions

  Attribute (Node *pOwner, const QString &sID)
  Attribute (Node *pOwner, bool bInstall)
void  Uninstall (void)

Protected Attributes

int  m_iSize
Attribute m_pSource
Attribute m_pNext
Store< Attribute * >  m_aTargets
Node m_pNode
QString  m_sName
bool  m_bSeparator
QString  m_sCategory
QString  m_sToolTip
float  m_fLabelWidth
bool  m_bConst
bool  m_bVisible
int  m_iIndex
QString  m_sID

Friends

class  Node

Member Enumeration Documentation

enum mudbox::Attribute::AttributeType
 

Type of the attribute.

Enumeration values:
typeUnknown  Unknown attribute.
typeInt  Standard integer, 4 bytes.
typeFloat  Standard float, 4 bytes.
typeBool  Standard bool, 1 bytes.
typeString  String attribute, can store any UNICODE text.
typePointer  Pointer attribute, see AttributePointer.
typeColor  Color attribute, 4xfloat, See Color.
typeVector  Vector, 3xfloat, see Vector.
typeEnum  Standard enum attribute, 4 bytes.
typeWatch  Empty attribute, used only to catch events. See AttributeWatch.
00174     {
00176         typeUnknown,
00178         typeInt,
00180         typeFloat,
00182         typeBool,
00184         typeString,
00186         typePointer,
00188         typeColor,
00190         typeVector,
00192         typeEnum,
00194         typeWatch
00195     };

Constructor & Destructor Documentation

virtual mudbox::Attribute::~Attribute void   )  [virtual]
 
mudbox::Attribute::Attribute Node pOwner,
const QString &  sID
[protected]
 
mudbox::Attribute::Attribute Node pOwner,
bool  bInstall
[protected]
 

Member Function Documentation

unsigned int mudbox::Attribute::TargetCount void   )  const
 

Returns the number of attributes currently linked to this attribute as target.

Attribute* mudbox::Attribute::Target unsigned int  iIndex  )  const
 

Returns the target with the given index. If iIndex is greater than the number of targets, returns 0;.

Attribute* mudbox::Attribute::Source void   ) 
 

Returns the source attribute, or 0 if there is no source.

bool mudbox::Attribute::operator== const Attribute cAttribute  )  const
 

This is a special operator, it does NOT compare the value of the attribute. See Node::OnNodeEvent for details.

bool mudbox::Attribute::operator!= const Attribute cAttribute  )  const
 

This is a special operator, it does NOT compare the value of the attribute. See Node::OnNodeEvent for details.

virtual AttributeType mudbox::Attribute::Type void   )  const [virtual]
 

Returns the type of the attribute.

Reimplemented in mudbox::AttributeCheckableFloat, mudbox::AttributeInstance< type >, mudbox::AttributePointer< type >, mudbox::AttributeInstance< Color >, mudbox::AttributeInstance< Vector >, mudbox::AttributeInstance< StampConfiguration >, mudbox::AttributeInstance< QString >, mudbox::AttributeInstance< float >, mudbox::AttributeInstance< int >, mudbox::AttributeInstance< NURBSCurve * >, mudbox::AttributeInstance< bool >, mudbox::AttributeInstance< type * >, mudbox::AttributeInstance< CheckableFloat >, mudbox::AttributeInstance< MirrorConfiguration >, and mudbox::AttributePointer< NURBSCurve >.

QString mudbox::Attribute::ID void   )  const
 

Returns the unique ID (within this node) of the attribute.

QString mudbox::Attribute::Name void   )  const
 

Returns the name of the attribute.

void mudbox::Attribute::SetName const QString &  sName  ) 
 

Sets the name of the attribute.

QString mudbox::Attribute::Category void   )  const
 

Returns the category of the attribute.

void mudbox::Attribute::SetCategory const QString &  sCategory,
bool  bSeparator = false
 

Sets the category of the attribute. This value will be used in the user interface to determine which attribute group to be used.

bool mudbox::Attribute::Separator void   )  const
 

Returns the separator state of the widget.

void mudbox::Attribute::SetSeparator bool  bSeparator  ) 
 

Call this with true to display a separator line below this widget.

bool mudbox::Attribute::Const void   )  const
 

Gets the constant status of the attribute. Default value is false. If this is set to true the attribute will not be editable by the user on the interface.

void mudbox::Attribute::SetConst bool  bConst  ) 
 

Sets the constant status of the attribute. Default value is false. If this is set to true the attribute will not be editable by the user on the interface.

bool mudbox::Attribute::Visible void   )  const
 

Returns true if the property is visible.

void mudbox::Attribute::SetVisible bool  bVisible  ) 
 

Sets the visible status of the property.

QString mudbox::Attribute::ToolTip void   )  const
 

Gets the tooltip text to be used on the user interface, this is optional.

void mudbox::Attribute::SetToolTip const QString &  sToolTip  ) 
 

Sets the tooltip text to be used on the user interface, this is optional.

unsigned int mudbox::Attribute::Size void   )  const
 

Returns the size of the attribute value in bytes.

float mudbox::Attribute::LabelWidth void   )  const
 

Returns the width of label relative to the full width of the line.

A value 0.4 means that the label will take 40%, while the value part will take 60% of the available space.

void mudbox::Attribute::SetLabelWidth float  fLabelWidth  ) 
 

Set the width of label.

int mudbox::Attribute::Index void   )  const
 

Returns the attribute index;.

void mudbox::Attribute::SetIndex int  iIndex  ) 
 

Sets the attribute index;.

Node* mudbox::Attribute::Owner void   )  const
 

Gets the address of the Node which contains this attribute.

virtual void mudbox::Attribute::Serialize Stream s  )  [virtual]
 

Serialize the value of the attribute into a stream.

Reimplemented in mudbox::AttributeInstance< type >, mudbox::AttributePointer< type >, mudbox::AttributeInstance< Color >, mudbox::AttributeInstance< Vector >, mudbox::AttributeInstance< StampConfiguration >, mudbox::AttributeInstance< QString >, mudbox::AttributeInstance< float >, mudbox::AttributeInstance< int >, mudbox::AttributeInstance< NURBSCurve * >, mudbox::AttributeInstance< bool >, mudbox::AttributeInstance< type * >, mudbox::AttributeInstance< CheckableFloat >, mudbox::AttributeInstance< MirrorConfiguration >, and mudbox::AttributePointer< NURBSCurve >.

virtual QString mudbox::Attribute::AsString void   )  const [virtual]
 

Returns the value of the attribute as a string. See also SetFromString.

Reimplemented in mudbox::AttributeCheckableFloat, mudbox::AttributeInstance< type >, mudbox::AttributePointer< type >, mudbox::AttributeInstance< Color >, mudbox::AttributeInstance< Vector >, mudbox::AttributeInstance< StampConfiguration >, mudbox::AttributeInstance< QString >, mudbox::AttributeInstance< float >, mudbox::AttributeInstance< int >, mudbox::AttributeInstance< NURBSCurve * >, mudbox::AttributeInstance< bool >, mudbox::AttributeInstance< type * >, mudbox::AttributeInstance< CheckableFloat >, mudbox::AttributeInstance< MirrorConfiguration >, and mudbox::AttributePointer< NURBSCurve >.

virtual void mudbox::Attribute::SetFromString const QString &  sValue  )  [virtual]
 

Sets the value of the attribute as a string. See also AsString.

Reimplemented in mudbox::AttributeCheckableFloat, mudbox::AttributeInstance< type >, mudbox::AttributePointer< type >, mudbox::AttributeInstance< Color >, mudbox::AttributeInstance< Vector >, mudbox::AttributeInstance< StampConfiguration >, mudbox::AttributeInstance< QString >, mudbox::AttributeInstance< float >, mudbox::AttributeInstance< int >, mudbox::AttributeInstance< NURBSCurve * >, mudbox::AttributeInstance< bool >, mudbox::AttributeInstance< type * >, mudbox::AttributeInstance< CheckableFloat >, mudbox::AttributeInstance< MirrorConfiguration >, and mudbox::AttributePointer< NURBSCurve >.

void mudbox::Attribute::ClearTargets void   ) 
 

Removes all outgoing connections from the attribute.

void mudbox::Attribute::ClearSource void   ) 
 

Removes the incoming connection for this attribute.

virtual void mudbox::Attribute::AddTarget Attribute cTarget  )  [virtual]
 

Adds a new outgoing connection for this node to pTarget.

Reimplemented in mudbox::AttributeInstance< type >, mudbox::AttributePointer< type >, mudbox::AttributeInstance< Color >, mudbox::AttributeInstance< Vector >, mudbox::AttributeInstance< StampConfiguration >, mudbox::AttributeInstance< QString >, mudbox::AttributeInstance< float >, mudbox::AttributeInstance< int >, mudbox::AttributeInstance< NURBSCurve * >, mudbox::AttributeInstance< bool >, mudbox::AttributeInstance< type * >, mudbox::AttributeInstance< CheckableFloat >, mudbox::AttributeInstance< MirrorConfiguration >, and mudbox::AttributePointer< NURBSCurve >.

void mudbox::Attribute::Connect Attribute cSource  ) 
 

Connect this attribute to another one.

virtual void mudbox::Attribute::UpdateTargets void   )  [virtual]
 

Update the values of all the connected target attributes with the current value. Used internally only, do not call this directly.

Reimplemented in mudbox::AttributeInstance< type >, mudbox::AttributeInstance< Color >, mudbox::AttributeInstance< Vector >, mudbox::AttributeInstance< StampConfiguration >, mudbox::AttributeInstance< QString >, mudbox::AttributeInstance< float >, mudbox::AttributeInstance< int >, mudbox::AttributeInstance< NURBSCurve * >, mudbox::AttributeInstance< bool >, mudbox::AttributeInstance< type * >, mudbox::AttributeInstance< CheckableFloat >, and mudbox::AttributeInstance< MirrorConfiguration >.

virtual const ClassDesc* mudbox::Attribute::TargetType void   )  const [virtual]
 

This is valid only for pointer attributes (See AttributePointer). Returns the type of the pointer.

virtual void mudbox::Attribute::SetPointerValue Node pValue,
bool  bLink = true
[virtual]
 

This is valid only for pointer attributes (See AttributePointer). Sets the value of the pointer. This function is used only if you dont know exactly the type of the attribute. Use AttributePointer::SetValue otherwise.

Reimplemented in mudbox::AttributePointer< type >, and mudbox::AttributePointer< NURBSCurve >.

virtual Node* mudbox::Attribute::PointerValue void   )  const [virtual]
 

This is valid only for pointer attributes (See AttributePointer). Gets the value of the pointer. This function is used only if you dont know exactly the type of the attribute. Use AttributePointer::Value otherwise.

virtual bool mudbox::Attribute::ValidatePointerValue const Node pValue  )  [virtual]
 

Validate a possible value for the pointer, returns true if the value is acceptable.

virtual void mudbox::Attribute::StartEvent NodeEventType  cType  )  const [virtual]
 

Reimplemented in mudbox::AttributePointer< type >, mudbox::AttributeFloatRange, and mudbox::AttributePointer< NURBSCurve >.

void mudbox::Attribute::SetOwner Node pOwner  ) 
 

This function sets the owner of the attribute. The owner receives all events for this attribute.

The owner is the receiver of all events from the attribute. This function removes any old owner & installs a new owner. If NULL or 0 is used as an argument then the old owner is removed and no owner exists for this attribute.

virtual AttributeWidget* mudbox::Attribute::CreateEditorWidget QWidget *  pParent,
int  iWidth
[virtual]
 

This function creates and returns the address of a QWidget object.

The object then can be used in the interface to give the user control over the attribute value. Mudbox calls this function for every attribute in a node when it displays a properties dialog box for it. You must override it if you implement a new kind of attribute and want a special interface.

Parameters:
iWidth  Width of the control in pixels.

Reimplemented in mudbox::AttributeCheckableFloat, mudbox::AttributeInstance< type >, mudbox::AttributeFloatRange, mudbox::AttributeEnumeration, mudbox::AttributeFilename, mudbox::AttributeTextureFilename, mudbox::AttributeInstance< Color >, mudbox::AttributeInstance< Vector >, mudbox::AttributeInstance< StampConfiguration >, mudbox::AttributeInstance< QString >, mudbox::AttributeInstance< float >, mudbox::AttributeInstance< int >, mudbox::AttributeInstance< NURBSCurve * >, mudbox::AttributeInstance< bool >, mudbox::AttributeInstance< type * >, mudbox::AttributeInstance< CheckableFloat >, mudbox::AttributeInstance< MirrorConfiguration >, and mudbox::AttributePointer< type >.

virtual unsigned int mudbox::Attribute::ParameterCount void   )  const [virtual]
 

Reimplemented in mudbox::AttributeFilename.

virtual QString mudbox::Attribute::ParameterName unsigned int  iIndex  )  const [virtual]
 

Returns the name of a parameter with a given index.

Reimplemented in mudbox::AttributeFilename.

virtual QString mudbox::Attribute::ParameterValue unsigned int  iIndex  )  const [virtual]
 

Returns the value of parameter with a given index.

Reimplemented in mudbox::AttributeFilename.

virtual void mudbox::Attribute::SetParameterValue const QString &  sName,
const QString &  sValue
[virtual]
 

Set the value of a parameter.

Reimplemented in mudbox::AttributeFilename.

void mudbox::Attribute::LogTargets void   ) 
 

Log all targets (for debug purposes).

void mudbox::Attribute::Uninstall void   )  [protected]
 

Friends And Related Function Documentation

friend class Node [friend]
 

Reimplemented in mudbox::AttributePointer< type >, and mudbox::AttributePointer< NURBSCurve >.


Member Data Documentation

int mudbox::Attribute::m_iSize [protected]
 
Attribute* mudbox::Attribute::m_pSource [protected]
 
Attribute * mudbox::Attribute::m_pNext [protected]
 
Store<Attribute *> mudbox::Attribute::m_aTargets [protected]
 
Node* mudbox::Attribute::m_pNode [protected]
 
QString mudbox::Attribute::m_sName [protected]
 
bool mudbox::Attribute::m_bSeparator [protected]
 
QString mudbox::Attribute::m_sCategory [protected]
 
QString mudbox::Attribute::m_sToolTip [protected]
 
float mudbox::Attribute::m_fLabelWidth [protected]
 
bool mudbox::Attribute::m_bConst [protected]
 
bool mudbox::Attribute::m_bVisible [protected]
 
int mudbox::Attribute::m_iIndex [protected]
 
QString mudbox::Attribute::m_sID [protected]